package com.larry.mr.writablecomparable2;

import org.apache.hadoop.io.WritableComparable;
import org.apache.hadoop.io.WritableComparator;

/**
 * @ProjectName hadoop
 * @Author larry
 * @Date 11:30 2021/11/16
 * @Description TODO
 **/
public class FlowBeanComparator extends WritableComparator {

    //实例化
    public FlowBeanComparator() {
        super(FlowBean.class,true);
    }

    @Override
    public int compare(WritableComparable a, WritableComparable b) {
        FlowBean aa = (FlowBean) a;
        FlowBean bb = (FlowBean) b;

        return -aa.getSumFlow().compareTo(bb.getSumFlow());

    }
}
